package epam.bookShelf.database;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;


public interface BookShelfDAO {    
	/**
	 * Starting DAO. Initialize connection pool and make other prepares for
	 * proper work. Is called only once per lifecycle. 
	 * @throws SQLException
	 */
	public void start() throws SQLException;    
    
	/**
	 * Stopping DAO. Destroy connection pool. Is called only once per lifecycle.
     * @throws SQLException
     */
    public void stop() throws SQLException;
    
    /**
     * Get connection from pool. For proper work, when work with connection 
     * has been finished, connection must be closed.
     * @return
     * @throws SQLException
     */
    public Connection getConnection() throws SQLException;            
    
    /**
     * Closing connection
     * @param conn	closing connection
     */
    public void closeConnection(Connection conn);
    
    /**
     * Close statement
     * @param myStat closing statement
     */
    public void closeStatement(PreparedStatement myStat);
}
